package com.toweave.starter.components;

import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;


public class ToastUtil {
  private static Toast toast;
  public ToastUtil(Context context, String message) {
    if (toast != null) {
      toast.cancel();
    }
    toast = Toast.makeText(context, message, Toast.LENGTH_SHORT);
    // 在屏幕顶部中间显示，Y偏移100像素
    toast.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, 0);
    toast.show();
  }
}
